package com.sc.web.gwt.client.view.RegisterWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.*;

/**
 * Created by IntelliJ IDEA.
 * User: admin
 * Date: 6/7/11
 * Time: 4:28 PM
 * To change this template use File | Settings | File Templates.
 */
public class RegisterWidgetViewImpl extends Composite implements RegisterWidgetView {
    private static Binder binder = GWT.create(Binder.class);

    public interface Binder extends UiBinder<HTMLPanel, RegisterWidgetViewImpl> {
    }

    private Presenter presenter;

    @UiField
    Button register;

    @UiField
    Button clear;

    @UiField
    PasswordTextBox confirm;

    @UiField
    PasswordTextBox password;

    @UiField
    TextBox serial;

    @UiField
    TextBox userName;


    public RegisterWidgetViewImpl() {
        initWidget(binder.createAndBindUi(this));
    }

    public void setPresenter(Presenter presenter) {
        this.presenter = presenter;
    }

    @UiHandler("register")
    public void handleRegisterClick(ClickEvent event) {

    }

    @UiHandler("clear")
    public void handleClearClick(ClickEvent event) {
        presenter.clearFields();
    }

    public void clearFields() {
        userName.setText("");
        password.setText("");
        confirm.setText("");
        serial.setText("");
    }
}
